<?php

namespace App\Resources;

use App\Resources\Collections\UserSocialAccountCollection;
use Illuminate\Http\Resources\Json\JsonResource;

class UserProfileResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'avatar' => $this->avatar,
            'birthday' => $this->birthday,
            'gender' => $this->gender == null ? null : intval($this->gender),
            'username' => $this->username,
            'phone' => $this->phone,
            'area_code' => $this->area_code,
            'social_accounts' => new UserSocialAccountCollection($this->social_accounts),
        ];
    }
}